import { setLocal, getLocal, removeLocal } from "../../untils/localSave";
export default {
  namespaced: true,
  state: {
    token: getLocal("token") || "",
    username: getLocal("username") || "请登录",
    Uid:getLocal("Uid")||""
  },
  mutations: {
    SET_USER_MESSAGE(state, data) {
        setLocal("token", data.token);
        state.token = data.token;
      setLocal("username", data.user);
      state.username = data.user;
      setLocal("Uid", data.Uid);
      state.Uid = data.Uid;
    },
    REMOVE_USER_MESSAGE(state) {
      removeLocal("token");
      removeLocal("username");
      removeLocal("Uid");
      state.Uid = "";
      state.token = "";
      state.username = "";
    },
  },

}; 